home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / text / edit / BareED.lha / BareED / rexx / RemRemarks.rx < prev   
Encoding:
Text File  |  2000-02-29  |  1.1 KB  |  59 lines

  1. /* Remove remarks of a Shell or equivalent script (e.g. BareED.cfg) */
  2.  
  3. BAREED_HOST = GetClip('BAREED')
  4.  
  5. IF BAREED_HOST = '' THEN DO
  6.     CALL SetClip('BAREED')    /* Remove from ClipNode */
  7.     EXIT 5
  8.     END
  9.  
  10. ADDRESS VALUE BAREED_HOST
  11.  
  12. CALL SetClip('BAREED')        /* Remove from ClipNode */
  13.  
  14. OPTIONS RESULTS
  15.  
  16. /* ---------------------- MAIN --------------------- */
  17.  
  18. casetell "WARNING"'0a'x'0a'x"Going to remove all tabs and also"'0a'x"remarks introduced by a semicolon"'0a'x'0a'x"Sure to go ahead?"
  19. IF RESULT == 0 THEN
  20.     EXIT
  21.  
  22. set findmode
  23. set find string ";"
  24.  
  25. terminate = 0
  26.  
  27. /* Delete remarks */
  28. DO WHILE terminate == 0
  29.     find next string
  30.     terminate = RC
  31.     IF RC ~= 0 THEN
  32.         BREAK
  33.  
  34.     delete to lineend
  35.     move cursor left
  36.     get current char
  37.  
  38.     IF RC == 0 THEN DO
  39.         IF C2D(RESULT) == 10 THEN
  40.             delete current char
  41.     END
  42. END
  43.  
  44. set find string '09'x
  45. set replace string '0a'x
  46. move cursor archivestart
  47. replace all
  48.  
  49. set find string '0a'x||'0a'x
  50. set replace string '0a'x
  51. move cursor archivestart
  52. replace all
  53.  
  54. /* Delete first line of file if it is a remark */
  55. move cursor archivestart
  56. get current char
  57. IF RESULT == ";" THEN
  58.     delete current line
  59.